package com.qiangesoft.blog.system.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qiangesoft.blog.common.mvc.PageQuery;
import com.qiangesoft.blog.common.mvc.PageResultVO;
import com.qiangesoft.blog.common.result.ResponseResult;
import com.qiangesoft.blog.system.authentication.satoken.OnlineUser;
import com.qiangesoft.blog.system.entity.SysMenu;
import com.qiangesoft.blog.system.entity.SysUser;
import com.qiangesoft.blog.system.pojo.dto.*;
import com.qiangesoft.blog.system.pojo.vo.SysUserDetailVO;

import java.util.List;

/**
 * <p>
 * 用户基础信息 服务类
 * </p>
 *
 * @author qiange
 * @since 2023-06-01
 */
public interface ISysUserService extends IService<SysUser> {

    /**
     * 查询用户
     *
     * @param pageQuery
     * @param username
     * @param state
     * @return
     */
    PageResultVO<SysUser> listUser(PageQuery pageQuery, String username, Boolean state);

    /**
     * 查询用户
     *
     * @param username
     * @param phoneNumber
     * @param email
     * @param nickname
     * @param state
     * @return
     */
    List<SysUser> listUserByParam(String username, String phoneNumber, String email, String nickname, Boolean state);

    /**
     * 分页查询用户
     *
     * @param pageNum
     * @param pageSize
     * @param phoneNumber
     * @param username
     * @param email
     * @param nickname
     * @param state
     * @return
     */
    Page<SysUser> pageUserByParam(Integer pageNum, Integer pageSize, String phoneNumber, String username, String email, String nickname, Boolean state);

    /**
     * 用户详情
     *
     * @param id
     * @return
     */
    SysUserDetailVO getUserById(Long id);

    /**
     * 新增用户
     *
     * @param userSave
     */
    void insertUser(UserSaveDTO userSave);

    /**
     * 更新用户
     *
     * @param userSave
     */
    void updateUser(Long id, UserSaveDTO userSave);

    /**
     * 批量删除用户
     *
     * @param ids
     */
    void deleteBatch(List<Long> ids);

    /**
     * 修改密码
     *
     * @param passwordDTO
     */
    void updatePassword(PasswordDTO passwordDTO);

    /**
     * 当前用户信息
     *
     * @return
     */
    SysUserDetailVO getCurrentUserInfo();

    /**
     * 当前用户菜单
     *
     * @return
     */
    List<SysMenu> getCurrentUserMenu();

    /**
     * 在线用户
     *
     * @param pageQuery
     * @param keywords
     * @return
     */
    PageResultVO<OnlineUser> listOnlineUsers(PageQuery pageQuery, String keywords);

    /**
     * 踢人下线
     *
     * @param token
     */
    void kick(String token);

    /**
     * 通过用户名查询用户
     *
     * @param username
     * @return
     */
    SysUser getByUsername(String username);

    void emailRegister(EmailRegisterDTO emailRegisterDTO);

    ResponseResult updatePassword(EmailRegisterDTO emailRegisterDTO);

    ResponseResult emailLogin(EmailLoginDTO emailLoginDTO);

    ResponseResult qqLogin(QQLoginDTO qqLoginDTO);

    ResponseResult weiboLogin(String code);

    ResponseResult giteeLogin(String code);

    ResponseResult sendEmailCode(String email);

    ResponseResult bindEmail(UserAuthDTO vo);

    void updateUser(UserAuthDTO vo);
}
